#ifdef UTIL_PLATFORM_WIN32
#include "lang/Runtime.h"
#include "windows.h"
#include "sysinfoapi.h"

namespace yzrilyzr_lang{
	int32_t Runtime::availableProcessors(){
		SYSTEM_INFO sysInfo;
		GetSystemInfo(&sysInfo);
		return (int32_t)sysInfo.dwNumberOfProcessors;
	}
	int64_t Runtime::totalMemory(){
		MEMORYSTATUSEX memoryStatus;
		memoryStatus.dwLength=sizeof(memoryStatus);
		GlobalMemoryStatusEx(&memoryStatus);
		return memoryStatus.ullTotalPhys;
	}

	int64_t Runtime::freeMemory(){
		MEMORYSTATUSEX memoryStatus;
		memoryStatus.dwLength=sizeof(memoryStatus);
		GlobalMemoryStatusEx(&memoryStatus);
		return memoryStatus.ullAvailPhys;
	}

	int64_t Runtime::maxMemory(){
		// 在 Windows 中，最大内存通常是总物理内存
		return totalMemory();
	}
}
#endif